# -*- coding:utf-8 -*-
try:
    import maya.cmds as cmds
except Exception as test_ERR:
    print('test')


def uv_set():
    sn = cmds.ls(l=1,type='mesh')

    wrong_uv_set=[]
    for m in sn:
        all_uv_set = cmds.polyUVSet(m, query=True, allUVSets=True)
        print(m,all_uv_set)
        if len(all_uv_set)>1:
            wrong_uv_set.append(m)
    return wrong_uv_set



def _run():
    try:
        wrong = uv_set()
        if wrong:
            choose = cmds.confirmDialog(title='result', message=u'含多UVset物体:\n' + str(wrong), icon='warning',
                                        button=['OK'], defaultButton=u'OK', cancelButton=u'OK',
                                        dismissString=u'OK')  # , dismissString=u'取消'
    except Exception as uvset_detect_ERR:
        print('uvset_detect_ERR:',str(uvset_detect_ERR))



def _doc():
    doc = {'name':u'UV set检测','doc':'对所有mesh进行UV set检测'}
    return doc